home *** CD-ROM | disk | FTP | other *** search
/ World of Education / World of Education.iso / world_m / mercuryz.zip / MANUAL < prev    next >
Text File  |  1992-03-24  |  40KB  |  1,282 lines

  1.  
  2. Mercury 2.00 manual
  3. ===================
  4.  
  5. (C) Copyright 1990 Roger Schlafly.
  6. All Rights Reserved.
  7.  
  8. Portions of the software (C) Copyright 1987-88 Borland International.
  9. All Rights Reserved.
  10.  
  11. Author's Note: This is a draft of the Mercury 2.00 manual, and was the
  12. latest ascii version.  Once I typeset it, it no longer became practical
  13. to update this version.  Registered copies of Mercury come with a 90
  14. page typeset manual which is more complete and has fewer errors.
  15.  
  16. Contents
  17. --------
  18.  
  19. 1. Introduction
  20.  Features
  21.  History
  22.  Shareware policy
  23.  Disclaimer
  24.  Files
  25.  Hardware Requirements
  26.  Installation
  27.  
  28. 2. Problems
  29.  Editing
  30.  Numbers
  31.  Operators
  32.  Constants
  33.  
  34. 3. Solving
  35.  Solutions
  36.  Graphs
  37.  Reports
  38.  
  39. 4. Feature Reference
  40.  Functions
  41.  Statements
  42.  Commands
  43.  
  44.  
  45.  
  46. 1. Introduction
  47.  
  48. Introduction
  49. ------------
  50.  
  51. Mercury is a program for solving equations on the IBM PC.  It is
  52. easy to use, interactive, and powerful.  With it, you can
  53.  
  54. * evaluate mathematical expressions.
  55.  
  56. * solve for the roots of an equation.
  57.  
  58. * solve a system of equations.
  59.  
  60. * maximize or minimize a function, with or without constraints.
  61.  
  62. * evaluate derivatives and definite integrals.
  63.  
  64. * plot one or more functions.
  65.  
  66. * print a report or a graph.
  67.  
  68. Mercury has a built-in editor, pull-down menus, online help,
  69. and all the conveniences necessary to make it accessible to
  70. computer novices.
  71.  
  72. For a quick demonstration of Mercury's capabilities, run MERCURY
  73. and then load and solve some of the sample problems (*.EKA).  If
  74. you get stuck, just press the F1 key for help.
  75.  
  76. Mercury is an outgrowth of Eureka, a product of Borland
  77. International of Scotts Valley, California.  When
  78. Borland decided to concentrate on spreadsheet and database
  79. products, Eureka was spun off.  Mercury was
  80. developed from that code base, and is being released in this
  81. form to satisfy customer requests for new versions of Eureka.  It
  82. is labelled version 2.0 because it is similar to what version 2.0 of
  83. Eureka would have been.
  84.  
  85. Eureka was also available on the Apple Macintosh.  No version
  86. of Mercury for the Macintosh is planned at this time.
  87.  
  88. Mercury is available as Shareware.  Shareware is a name for
  89. programs which are distributed freely or at nominal charge, but
  90. which are copyrighted and have restrictions on their usage.
  91.  
  92. Mercury may be copied freely for examination purposes.  Distributors
  93. may charge a nominal fee, provided that they adhere to the conditions in
  94. VENDOR.DOC.  Commercial and institutional use is prohibited
  95. without a registered license.  Such a license may be obtained by
  96. sending $49 to
  97.  
  98.     Real Software
  99.     PO Box 1680
  100.     Soquel, CA  95073
  101.     USA
  102.  
  103.     phone or fax: 408-476-3550
  104.     CompuServe: 76646,323
  105.     Genie: R.Schlafly
  106.     BBS: 408-476-1055
  107.  
  108. Payment may be by check, MasterCard, or Visa.  See REGISTER.DOC
  109. for an order form.  Foreign orders should include $5 for shipping.
  110.  
  111. Those who register a license will get the latest version of the
  112. software, an installation program, and a printed manual.  They will
  113. be eligible for technical support, and will be on the mailing list
  114. for future information and updates.
  115.  
  116. Site licenses and other special arrangements are available.
  117.  
  118. Comments, bug reports, and suggestions are especially welcome.
  119.  
  120.  
  121. Disclaimer
  122. ----------
  123.  
  124. The author has made his best effort in producing this software, but
  125. hereby disclaims all warranties.  He will not be liable for any damages
  126. exceeding the price paid for the license to use the software.  The
  127. person using the software bears all risk as to the quality and
  128. performance of the software.
  129.  
  130. Mercury is not a Borland product.  Borland will not provide any
  131. technical support.  Eureka is a registered trademark of Borland
  132. International.  Borland copyrights and trademarks are used with
  133. permission.  Mercury is a trademark of the author.
  134.  
  135.  
  136. Files
  137. -----
  138.  
  139. Mercury consists of these files.
  140.  
  141. MERCURY.EXE           main program
  142. MERCURY.HLP           help file
  143. *.BGI                 graphics drivers
  144. *.CHR                 fonts
  145. *.EKA                 sample problems
  146. MANUAL                user manual (this file)
  147. README                quick instructions
  148. REGISTER.DOC          registration form
  149. VENDOR.DOC            vendor information
  150.  
  151. Auxilliary files:
  152.  
  153. *.EKA                 more sample problems
  154. *.BGI                 more graphics drivers
  155. *.BIN                 external functions
  156. *.C                   source to external functions
  157. MATHL.H               tools for making external functions
  158. *.OBJ                 tools for making external functions
  159. *.LIB                 tools for making external functions
  160.  
  161. If you downloaded Mercury from an online service, you may find the
  162. auxilliary files archived separately.  The extra files are not needed
  163. by most people, and are stored separately to save on connect time.
  164. The extra drivers are for uncommon hardware only, and the tools for
  165. making external functions require Borland's Turbo C++.
  166.  
  167. Registered customers also get INST.COM, an installation program
  168. for configurable options.
  169.  
  170.  
  171. Hardware Requirements
  172. ---------------------
  173.  
  174. Mercury requires an IBM PC or clone with at least 640K
  175. of RAM.  About 500K of free RAM is needed.  In addition,
  176. extended memory (EMS memory) is used if present.  If a
  177. math coprocessor is available, it will be used.  A math
  178. coprocessor is recommended for serious number crunchers.
  179.  
  180. Plots require a graphics monitor and a CGA, EGA, VGA, or
  181. Hercules card.
  182.  
  183. You can print reports and graphs on any of the popular
  184. printers.  Select Printer and Model from the Options menu
  185. for the list of supported printers.
  186.  
  187.  
  188. Installation
  189. ------------
  190.  
  191. There are no special installation requirements.  The simplest
  192. procedure is to make a new directory on your hard disk, and to
  193. copy all of the files there.  You may wish to put the Mercury
  194. directory on your path, or to copy some of the files to your
  195. RAM disk.
  196.  
  197. The program INST may be used to change the edit key bindings,
  198. and to make a few other installation choices.  Various other
  199. configuration options are available from within Mercury, and
  200. these may be saved to disk.  See Options, below.
  201.  
  202. Mercury tries to detect automatically what hardware is present,
  203. but there some situations where you may want to override the
  204. detection logic.
  205.  
  206. If you have a CGA monitor, it may or may not have the "snow"
  207. problem.  If so, you may notice random snow on the screen as
  208. characters are written there.  If so, you can eliminate it by
  209. typing
  210.  
  211.     set CGASNOWCHK=Y
  212.  
  213. at the DOS prompt before loading Mercury.  There must not be any spaces
  214. surrounding the equals sign.
  215.  
  216. Mercury automatically detects the math coprocessor, but
  217. occasionally Mercury fails because the chip is defective.  It can
  218. be turned off with
  219.  
  220.     set 87=N
  221.  
  222. at the DOS prompt.
  223.  
  224. Mercury also detects various graphics cards, but some cannot be
  225. detected.  See the SCREEN statement in Chapter 4.
  226.  
  227. If you have a graphics printer, you will want to select it at the
  228. Printer menu.  The graphics card and printer selection can be
  229. saved to the MERCURY.CFG file, and then it will be automatic each
  230. time Mercury is loaded.
  231.  
  232.  
  233. Errors
  234. ------
  235.  
  236. Error messages are pretty much self-explanatory.  If an error is
  237. detected while parsing the problem file, Mercury puts you in the
  238. Edit window with the cursor at the point of the error.  The error
  239. message at the top of the window, and disappears as soon as you
  240. start editing.  Other errors are displayed in a special box which
  241. is placed on the screen.  After you acknowledge the error by
  242. pressing the Escape key, you are put back in the menu system.
  243.  
  244.  
  245. 2. Problems
  246.  
  247. A problem is entered into Mercury by either loading an existing
  248. one from the disk, or by creating a new one in the Edit window.  This
  249. chapter explains how to use the editor, and how to create a problem
  250. for solving.
  251.  
  252.  
  253. Editing
  254. -------
  255.  
  256. Mercury includes a complete text editor for creating and
  257. modifying problem files.  Usage of the editor is similar
  258. to WordStar in nondocument mode, or to
  259. Borland's SideKick.  The problem files are
  260. ordinary ascii files, and can be edited with any other
  261. text editor.
  262.  
  263. You can move the cursor around in the editor with the arrow
  264. keys, Page Up, Page Down, and some other keys listed below.  The
  265. editor has two typing modes, Insert and Overwrite.  In Insert
  266. mode, anything you type is inserted at the cursor position.  In
  267. Overwrite mode, pressing a key replaces the current character
  268. at the cursor position with the new typed character.  Initially,
  269. the editor operates in Insert mode, a default you
  270. can change with the INST program.  To switch modes, press the
  271. Insert key or Ctrl-V.  (Ctrl-V means to hold down the Ctrl key
  272. on your keyboard while you press V.  The V need not be in upper
  273. case.)
  274.  
  275. No Word-Wrap
  276. Unlike a more standard word processing program, the editor does
  277. not have word-wrap.  You must press Enter at the end of each line.
  278.  
  279. AutoIndent
  280. The editor has an autoindent feature that allows subsequent lines
  281. to automatically indent.  If you leave several spaces at the
  282. start of a line, use Ctrl-OI to indent subsequent lines the same
  283. amount.  The command sequence is a toggle, so you need only
  284. press Ctrl-OI again to stop indenting.
  285.  
  286. Zoom
  287. Sometimes you may want to see more than the area covered by the
  288. current window.  You can "zoom" the window, expanding it to the
  289. size of the entire screen, by pressing F5.  To return the window
  290. to its usual size, press F5 again.  For other window commands,
  291. such as moving and resizing a window, see the Window menu, below.
  292.  
  293. Here is a summary of the editing commands.  Many of these
  294. commands can be changed with the INST installation program.
  295.  
  296.   Cursor Movement Commands:
  297.  
  298.   Character left         Ctrl-S or Left arrow
  299.   Character right        Ctrl-D or Right arrow
  300.   Word left              Ctrl-A
  301.   Word right             Ctrl-F
  302.   Line up                Ctrl-E or Up arrow
  303.   Line down              Ctrl-X or Down arrow
  304.   Scroll up              Ctrl-W
  305.   Scroll down            Ctrl-Z
  306.   Page up                Ctrl-R
  307.   Page down              Ctrl-C
  308.   Left of line           Ctrl-QS or Home
  309.   Right of line          Ctrl-QD or End
  310.   Top of screen          Ctrl-QE or Ctrl-Home
  311.   Bottom of screen       Ctrl-QX or Ctrl-End
  312.   Top of file            Ctrl-QR or Ctrl-PgUp
  313.   Bottom of file         Ctrl-QC or Ctrl-PgDn
  314.   Move to block begin    Ctrl-QB
  315.   Move to block end      Ctrl-QK
  316.   Move to previous point Ctrl-QP
  317.   Move to marker 0       Ctrl-Q0
  318.   Move to marker 1       Ctrl-Q1
  319.   Move to marker 2       Ctrl-Q2
  320.   Move to marker 3       Ctrl-Q3
  321.   Set marker 0           Ctrl-K0
  322.   Set marker 1           Ctrl-K1
  323.   Set marker 2           Ctrl-K2
  324.   Set marker 3           Ctrl-K3
  325.  
  326.   Insert & Delete Commands:
  327.  
  328.   Insert mode on/off     Ctrl-V or Ins
  329.   Insert line            Ctrl-N
  330.   Delete line            Ctrl-Y
  331.   Delete to end of line  Ctrl-QY
  332.   Delete character left  Ctrl-H or Backspace
  333.   Delete character       Ctrl-G or Del
  334.   Delete word right      Ctrl-T
  335.  
  336.   Block commands:
  337.  
  338.   Set block begin        Ctrl-KB or F7
  339.   Set block end          Ctrl-KK or F8
  340.   Mark word              Ctrl-KT
  341.   Hide block             Ctrl-KH
  342.   Copy block             Ctrl-KC
  343.   Move block             Ctrl-KV
  344.   Delete block           Ctrl-KY
  345.   Read block             Ctrl-KR
  346.   Write block            Ctrl-KW
  347.   Print block            Ctrl-KP
  348.  
  349.   Miscellaneous Commands:
  350.  
  351.   Quit edit, no save     Ctrl-KD, Ctrl-KQ, or Esc
  352.   Save and edit          Ctrl-KS or F2
  353.   New file               F3
  354.   Tab                    Ctrl-I or Tab
  355.   Tab mode toggle        Ctrl-OT
  356.   Auto indent on/off     Ctrl-OI
  357.   Restore line           Ctrl-QL
  358.   Find                   Ctrl-QF
  359.   Find & replace         Ctrl-QA
  360.   Repeat last find       Ctrl-L
  361.   Control key prefix     Ctrl-P
  362.   Abort operation        Ctrl-U
  363.   Restore error message  Ctrl-QW
  364.  
  365.   Search Options:
  366.  
  367.   B           Backwards search
  368.   G           Global search
  369.   n           n = any number. Search n times
  370.   N           Replace without asking
  371.   U           Ignore upper/lower case
  372.   W           Search for whole words only
  373.   S           Soundex
  374.  
  375.  
  376. Problems
  377. --------
  378.  
  379. A problem is a text (ascii) file consisting of comments,
  380. definitions, equations, and statements.  See the sample
  381. files for examples of problems.
  382.  
  383. Comments are not read by the Mercury solver, and serve
  384. merely for clarity or documentation.  A comment starts
  385. with a semicolon (;) and runs until the end of the line.
  386. Alternatively, comments can be enclosed in curly braces ({})
  387. and may occupy several lines.
  388.  
  389. Definitions may be either variable initializations or function
  390. definitions and are characterized by the := assignment
  391. operator.  If the left-hand-side is a name, it is taken to
  392. be a variable and the right-hand-side is an expression which
  393. evaluates to the initial value for that variable.  Such initial
  394. values can be critical to the iterative solver.  If the
  395. left-hand-side is a function, as in Square(x) := x^2, then the
  396. right-hand-side serves as the definition for that function.  In
  397. this case, Square is then a function of one argument, and
  398. Square(5) = 25.
  399.  
  400. Equations have a mathematical expression on each side of
  401. an equals sign (=).  An equation may also be an inequality
  402. constraint, in which case the equals sign is replaced by
  403. <, <=, >, or >=.
  404.  
  405. Statements are special directives to Mercury.  They are
  406. instructions either to do something other than solve the equations,
  407. or to control the solution process.  The allowed statements
  408. are listed below, and examples are in the problem files.
  409.  
  410.  
  411. Numbers
  412. -------
  413.  
  414. The range of numbers is plus or minus 1e-307 to 1e+307.
  415.  
  416. When using the exact solver, a question mark indicates that the
  417. next digit is uncertain.  For example, 1.23? indicates a number
  418. that might be anything between 1.225 and 1.235, as these are the
  419. numbers which round to 1.23.
  420.  
  421. Imaginary numbers are indicated with the suffix i.  For example,
  422. x = 2 + 3i is the complex number with real part 2 and imaginary
  423. part 3.
  424.  
  425. Percentages may be expressed with the suffix %.  For example, 5.1%
  426. is the same as .051.
  427.  
  428.  
  429. Examples
  430. --------
  431.  
  432. A number of example problem files (*.EKA) are on the program
  433. disk.  Examination of these is strongly recommended, as these
  434. demonstrate most of Mercury's features.  See Chapter 5.
  435.  
  436.  
  437. 3. Solving
  438.  
  439.  
  440. Solving
  441. -------
  442.  
  443. Mercury features three solver technologies.
  444.  
  445. 1. Direct solver.  This method consists of applying the rules of
  446. high school algebra to manipulate the equations until solutions are
  447. obtained for all the variables.  For example,
  448.  
  449.     2 x + 3 y = 8
  450.     4 x + 5 y = 14
  451.  
  452. can be solved directly by rearranging the first equation to
  453. y = (8 - 2 x)/3 and substituting for y in the second equation.
  454.  
  455. See the LEVEL statement for user control over what manipulations
  456. are allowed.
  457.  
  458. 2. Iterative solver.  The most difficult systems of equations cannot
  459. be solved analytically.  The best we can do is find some approximate
  460. solution and then apply some iterative procedure to improve the
  461. accuracy.  In such case it is advisable to provide starting values
  462. for the variables.
  463.  
  464. 3. Exact solver.  Mercury's most innovative feature is its ability
  465. to use exact methods in many cases.
  466.  
  467.  
  468. Solution Window
  469. ---------------
  470.  
  471. When you apply Solve to a problem file, the result is in the
  472. Solution Window.  The window is editable like the Edit window,
  473. and can be scrolled and zoomed for easy viewed.  The contents
  474. can be saved in a report, if that is desired.
  475.  
  476. The solution lists all of the variables, with their final
  477. values.  Usually, the value is just a number, displayed to
  478. however many digits is specified in the DIGITS statements or
  479. menu options.
  480.  
  481. In some cases, a variable was solved directly and symbolically
  482. in terms of other variables.  If such an expression was used
  483. to calculate the value, then the expression is shown.
  484.  
  485. If no value was ever assigned to the variable, then its value
  486. is given as "UNDEFINED" or "NO SOLUTION".  This occurs if the variable is
  487. used only as a dummy variable, such as in a function definition
  488. or as a variable of integration.
  489.  
  490. Occasionally, a variable value will be given as NAN, which
  491. means Not-A-Number.  This means the variable could not be computed
  492. accurately, and only crude bounds were obtained.  For example,
  493. a result "x = NAN(2.1,7.5)" indicates that x may be anything
  494. between 2.1 and 7.5.  Sometimes such imprecise results represent
  495. the best that can be said about an ill-posed problem, but sometimes
  496. it represents a failure on the part of Mercury.  Such results
  497. should be used with caution.
  498.  
  499. When a variable appears to have the value of a simple fraction,
  500. it is noted in the solution.  For example, solving 3 x = 1 gives
  501. x = 0.333333333333333 { 1 / 3 }.  The fraction is reduced, meaning
  502. that the numerator and denominator have no nontrivial factors.  The
  503. logic which recognizes these fractions is particularly effective
  504. with the Exact solver.
  505.  
  506. In some cases, multiple roots for some variable are found.  These
  507. are listed after the list of variable values.
  508.  
  509. If the problem file has a LIST statement, then the list of the
  510. abscissae and ordinate appear in the solution window.
  511.  
  512. The solution always has a list of residuals.  These are extremely
  513. important for assessing the validity and accuracy of a solution.
  514. A residual is a quantity that should be zero if the equation were
  515. solved perfectly.  It is the absolute value of the difference
  516. between the left and right hand sides of the equation.  For
  517. example, solving SIN(x) = .5 might give as a residual
  518.  
  519.    { 1E-16 }  SIN(x)-.5=0
  520.  
  521. The number in braces, 1E-16, is the residual.  It is the absolute
  522. value of SIN(x)-.5 using the solved value of x.  Residuals of this
  523. size are quite common, as internally Mercury calculates to 16-digit
  524. precision, and there is no machine representable x for which SIN(x)
  525. is exactly 0.5.
  526.  
  527. The equation to the right of the braces is often the same as one of
  528. the input equations, but sometimes Mercury rearranges some terms.
  529. It might be a simple rearrangement as above, but it may also the
  530. result of symbolically solving for one of variables and substituting
  531. it into other equations.  In any case, the equations shown with the
  532. residuals are the actual equations used by the solver.  Some control
  533. of the symbolic substitutions is allowed by the LEVEL statement or
  534. the Level option under the Solver menu.
  535.  
  536. Occasionally, you may see variables name T1, T2, ...  These are temporary
  537. variables introduced by Mercury in the course of solving.  Most
  538. commonly, they are used to enforce inequality constraints.
  539. The constraint
  540.  
  541.     EXP(x + y) + y * z <= 10
  542.  
  543. may be replaced with
  544.  
  545.     EXP(x + y) + y * z + T1 = 10
  546.     T1 >= 0
  547.  
  548. The latter has some technical advantages, even though there is an
  549. extra equation and an extra variable.  Values for the extra variable
  550. are not shown.
  551.  
  552. Finally, the solution ends with the largest residual, the method, and
  553. the processor.  The largest residual is simply the maximum of the
  554. previous residuals.  Assuming your problem is not scaled too badly,
  555. then anything less than about 1E-10 should be considered a success.
  556.  
  557. The method is Exact, Direct, or Iterative.  The exact and direct
  558. solvers are more reliable, and Mercury tries them first.  This logic
  559. can be altered with the METHOD statement.  The processor is a 8087,
  560. 80287, 80387, or emulator.
  561.  
  562.  
  563. Reports
  564. -------
  565.  
  566. A report is an unformatted ascii file holding the problem and the
  567. solution.  It can be saved to disk or printed to keep a record of
  568. the solution.  To save to disk, press Go in the Report menu.  (This
  569. menu item doesn't become active until you have solved a problem.)
  570. Normally, the report has the same name as the problem but with the
  571. .EKA suffix replaced with .RPT.  You can use other file names if you
  572. please.
  573.  
  574. Another way to keep a record of problems and solutions is to have
  575. a Log file.  Just turn Capture On in the Report menu.  Then all
  576. problems and solutions will be appended to a log file.
  577.  
  578. The reports and logs are ordinary ascii files, and can be printed.
  579. If you have a Postscript printer, you will have to select a mode
  580. in which it will accept an ascii file, or load a utility for
  581. printing ascii files.  (No such utility is provided with Mercury.)
  582.  
  583.  
  584. Graphics
  585. --------
  586.  
  587. Mercury may be used to generate graphs.  These visually show
  588. the behavior of functions.  A graphics monitor is required.
  589.  
  590. To get a graph, you must first define a function of one variable
  591. in your problem file.  An example from the file BUMPY.EKA is
  592.  
  593.     bumpy(x) := x^2 SIN(x)
  594.  
  595. which defines a function called "bumpy".  The "x" is a dummy variable.
  596. The has values func(0) = 0^2 SIN(0), func(1) = 1^2 SIN(1), etc.  To
  597. graph the function from -15 to +15, use the statements:
  598.  
  599.     PLOT bumpy
  600.     GBOUNDS -15, +15
  601.  
  602. To assimilate this information into the Mercury solver, you must do
  603. a Solve, even though you are not really solving for anything in this
  604. case.  Once the problem has been solved, the View, Print, and Write
  605. commands become available under the Graph menu.  Select View to see
  606. the graph on the screen.
  607.  
  608. If the graph looks a little ragged, perhaps not enough points were
  609. used to plot it.  The default is 30.  Increasing it to 100 will give
  610. a much smoother graph.  This can be done by either adding the
  611. GPOINTS 100 statement to the problem file and solving it again, or
  612. by selecting GPoints from the Graph menu.
  613.  
  614. It is also possible to have "parametric" plots, where both X and
  615. Y are functions of some other independent variable.  Merely use
  616. the XAXIS statement to specify the X function.  The GBOUNDS statement
  617. then refers to the independent variable.
  618.  
  619. These graphs can be printed on graphics printers.  This includes
  620. most printers, except for daisy-wheel printers.  Selecting Print
  621. will print the graph to whatever printer has been selected under
  622. the Options/Printer menu.
  623.  
  624. You can also select Write, which prints the graph to a file.  Such
  625. a file can be sent to a printer at a later time.  The primary
  626. usefulness of this feature is to export the graph in Lotus or
  627. Postscript format, where it can be imported by another program.
  628.  
  629. The various options in the Graph menu are really the defaults, and
  630. are overridden by the corresponding statements in the problem file.
  631. If there are statements in the problem file setting graph options,
  632. then the menu may not accurately reflect the options used to draw
  633. the graph.  Nevertheless, once a graph has been created, these
  634. options can be modified from the graph menu, and then View will
  635. show the revised graph.
  636.  
  637.  
  638. 4. Feature Reference
  639.  
  640. This chapter gives an alphabetical lookup for the Mercury built-in
  641. functions and statements.
  642.  
  643.  
  644. Operators
  645. ---------
  646. +    add.
  647. -    subtract.
  648. *    multiply.  a space may also be used.
  649. /    divide.
  650. ^    power.  Eg, 2^3 = 8.
  651. ~    complex conjugate.
  652. <    less than.
  653. <=    less than.
  654. >    greater than.
  655. >=    greater than.
  656. =    equals.
  657. :=    variable initialization or function definition.
  658. :    equation separator.
  659. %    percent, eg, 17% = .17.
  660.  
  661. These have the usual mathematical precedence rules, with ^ having
  662. higher precedence than * and /, which in turn are higher than + and -.
  663.  
  664.  
  665. Constants
  666. ---------
  667.  
  668. These two constants are built-in.
  669.  
  670. INF    plus infinity
  671. PI    3.1415926535...  You can also use the greek letter by typing Alt-P.
  672.  
  673.  
  674. Functions
  675. ---------
  676.  
  677. Functions take one or more arguments.  The arguments are  separated
  678. by commas and enclosed in parentheses.  Here is a list of the
  679. built-in functions.  Additional functions can be defined within
  680. a problem file.
  681.  
  682. ABS(x)
  683.  
  684. The absolute value of x.  You can also use |x|.
  685.  
  686. ACOS(x)
  687.  
  688. The arc cosine of x, inverse to COS(x).
  689. The result is in radians.
  690.  
  691. ASIN(x)
  692.  
  693. The arc sine of x, inverse to SIN(x).
  694. The result is in radians.
  695.  
  696. ATAN(x)
  697.  
  698. The arc tangent of x, inverse to TAN(x).
  699. The result is in radians.
  700.  
  701. BESSJ(n,x)
  702.  
  703. The Bessel function of the first kind.
  704. The first argument must be an integer.
  705.  
  706. BESSY(n,x)
  707.  
  708. The Bessel function of the second kind, sometimes
  709. also called the Weber function.
  710. The first argument must be an integer.
  711. For each n, it is a solution to Bessel's
  712. differential equation with a singularity at zero.
  713.  
  714. BINOM(n,k)
  715.  
  716. The number of combinations, choosing k of n items.
  717. Given by  n! / (k! (n-k)!).
  718.  
  719. CEIL(x)
  720.  
  721. The smallest integer greater than or equal to x.
  722. Eg, CEIL(4.7) = 5.
  723.  
  724. COS(x)
  725.  
  726. The cosine of x.  The angle x is measured in radians.
  727.  
  728. COSH(x)
  729.  
  730. The hyperbolic cosine of x, (EXP(x) + EXP(-x))/2.
  731.  
  732. CTERM(rate,fv,pv)
  733.  
  734. The number of periods required for a given present
  735. value (pv) to increase to a given future value (fv)
  736. if it grows at the given interest rate.  The function
  737. is compatible with Quattro/Lotus.
  738.  
  739. DERIV(f(x),x)
  740.  
  741. The derivative of the function f(x) with respect to x.
  742. In most cases, the derivative is computed symbolically.
  743.  
  744. DLGAMMA(n,x)
  745.  
  746. The n-th derivative of LOGGAMMA, n = 0,1,2,...
  747.  
  748. ERF(x)
  749.  
  750. The error function of x.  It is related to NCUM(x).
  751.  
  752.          ERF(x) = 2 NCUM(x SQRT(2)) - 1
  753.  
  754. Eg, ERF(-INF) = -1, ERF(0) = 0, ERF(+INF) = +1.
  755.  
  756. ERFC(x)
  757.  
  758. The complementary error function of x.  See ERF and NCUM.
  759.  
  760.           ERFC(x) = 1 - ERF(x)
  761.  
  762. Eg, ERFC(-INF) = +1, ERFC(0) = 0, ERFC(+INF) = -1.
  763.  
  764. EXP(x)
  765.  
  766. The exponential function of x, e^x, e = 2.71828...
  767. It is the inverse to LN(x).
  768.  
  769. FACT(x)
  770.  
  771. x factorial, sometimes written x!.
  772. Eg, FACT(5) = 5*4*3*2*1 = 120.
  773.  
  774. FLOOR(x)
  775.  
  776. The largest integer less than or equal to x.
  777. Eg, FLOOR(4.7) = 4.
  778.  
  779. FRAC(x)
  780.  
  781. The fractional part of x, x - FLOOR(x).
  782. Eg, FRAC(4.7) = 0.7.
  783.  
  784. FV(pmt,rate,nper)
  785.  
  786. The future value of payments (pmt) at the end of nper
  787. periods, assuming the given interest rate.
  788. The function is compatible with Quattro/Lotus.
  789.  
  790. FVAL(rate,nper,pmt,pv)
  791.  
  792. Gives the future value of a financial with a payment
  793. pmt in each of nper periods, with the given present
  794. value pv, and the given interest rate.
  795. The function is compatible with Quattro Pro.
  796. It uses the financial mode specified by the FINANCE
  797. statement to determine whether the payments are at the
  798. end of the period (the default) or the beginning.
  799.  
  800. HYPOT(x,y)
  801.  
  802. The polar coordinate radius corresponding to cartesian
  803. coordinates (x,y).  Eg, HYPOT(3,4) = 5.
  804.  
  805. IFPOS(x,y,z)
  806.  
  807. Gives y if x >= 0, else it gives z.  Eg, IFPOS(-3,6,7) = 7.
  808.  
  809. IM(x)
  810.  
  811. The imaginary part of x.  The COMPLEX option must be in use.
  812.  
  813. INTEG(f(x),x,a,b)
  814.  
  815. INTEG(f(x),x,a,b) gives the numerical integral of f(x) with
  816. respect to x from a to b.  Improper integrals are allowed, so a
  817. can be -INF, b can be +INF, and f can be singular at a or b.  The
  818. approximation method is adaptive and nonlinear, and often is
  819. accurate to 15 digits.
  820.  
  821. INTEG1(f(x),x,a,b)
  822.  
  823. INTEG1 is similar to INTEG, but uses a simpler
  824. strategy.  It is nonadaptive and linear, and may be preferred in
  825. situations where the result is supposed to be a smooth function
  826. of a and b.  INTEG1 is not nearly as accurate as INTEG on
  827. singular functions.
  828.  
  829. LIMIT(f(x),x,a,INF)
  830.  
  831. Estimates the limit of f(x), as x goes from a to infinity.
  832. It uses a numerical method to compute the limit
  833. of f(x), as x goes from a to infinity.  It is an nonlinear
  834. extrapolation based on a fairly small number of terms.  The
  835. limit is only reliable if the function is well-behaved, and
  836. this feature should be used with caution.
  837.  
  838. LN(x)
  839.  
  840. The natural logarithm (base e) of x.
  841. It is the inverse to EXP(x).
  842.  
  843. LOG10(x)
  844.  
  845. The logarithm of x to the base 10.  The inverse is 10^x.
  846.  
  847. LOGGAMMA(x)
  848.  
  849. The logarithm of the gamma function of x.
  850.  
  851. MAX(x,...)
  852.  
  853. The maximum value of the arguments.
  854. Eg, MAX(-10,5,7) = 7.
  855.  
  856. MIN(x,...)
  857.  
  858. The minimum value of the arguments.
  859. Eg, MIN(-10,5,7) = -10.
  860.  
  861. NCUM(x)
  862.  
  863. The normal cumulative probability function.  NCUM(X) is the
  864. probability that a normal random variable is below its mean,
  865. plus X standard deviations.
  866.  
  867. Eg, NCUM(-INF) = 0, NCUM(0) = .5, NCUM(+INF) = 1.
  868.  
  869. PAYMT(rate,nper,pv,fv)
  870.  
  871. Gives the present value of a financial with a payment
  872. pmt in each of nper periods, with the given future
  873. value fv, and the given interest rate.
  874. The function is compatible with Quattro Pro.
  875. It uses the financial mode specified by the FINANCE
  876. statement to determine whether the payments are at the
  877. end of the period (the default) or the beginning.
  878.  
  879. PMT(pv,rate,nper)
  880.  
  881. Gives the amount of the payments required in each of nper
  882. periods to balance the given present value pv and interest rate.
  883. The function is compatible with Quattro/Lotus.
  884.  
  885. POLAR(x,y)
  886.  
  887. The polar coordinate angle corresponding to cartesian (x,y).
  888. Same as the Quattro/Lotus @ATAN2(x,y) or the Fortran/C atan2(y,x).
  889.  
  890. POLY(x,a0,a1,...,an)
  891.  
  892. The polynomial a0 x^n + ... + an.
  893. Eg, the polynomial 2 x^3 - 3 x + 7 can also be written
  894. POLY(x,2,0,-3,7).  The chief advantage of the latter is
  895. notational convenience, and so it can be recognized by the
  896. special polynomial solver.
  897.  
  898. POS(x)
  899.  
  900. The positive part of x, ie, x if positive and 0 if negative.
  901.  
  902. PV(pmt,rate,nper)
  903.  
  904. Gives the present value of nper payments of amount pmt,
  905. using the given interest rate.
  906. The function is compatible with Quattro/Lotus.
  907.  
  908. PVAL(rate,nper,pmt,fv)
  909.  
  910. Gives the present value of a financial with a payment
  911. pmt in each of nper periods, with the given future
  912. value fv, and the given interest rate.
  913. The function is compatible with Quattro Pro.
  914. It uses the financial mode specified by the FINANCE
  915. statement to determine whether the payments are at the
  916. end of the period (the default) or the beginning.
  917.  
  918. RATE(fv,pv,nper)
  919.  
  920. Gives the interest rate required for the present
  921. value (pv) to increase to the future value (fv) in
  922. nper periods.  The function is compatible with Quattro/Lotus.
  923.  
  924. RE(x)
  925.  
  926. The real part of x.  The COMPLEX option must be in use.
  927.  
  928. REM(x,y)
  929.  
  930. The remainder of x divided by y.  Eg, REM(20,3) = 2.
  931.  
  932. SGN(x)
  933.  
  934. Gives +1 if x > 0, -1 if x < 0.
  935.  
  936. SIN(x)
  937.  
  938. The sine of x.  The angle x is measured in radians.
  939.  
  940. SINH(x)
  941.  
  942. The hyperbolic sine of x, (EXP(x) - EXP(-x))/2.
  943.  
  944. SQRT(x)
  945.  
  946. The square root of x.
  947.  
  948. SUM(f(x),x,a,b)
  949.  
  950. The sum of f from a to b,
  951.  
  952.     f(a) + f(a + 1) + ... + f(b)
  953.  
  954. If b = +INF, the limit is estimated as with the LIMIT function.
  955.  
  956. TAN(x)
  957.  
  958. The tangent of x, SIN(x)/COS(x).
  959. The angle x is measured in radians.
  960.  
  961. TANH(x)
  962.  
  963. The hyperbolic tangent of x, SINH(x)/COSH(x).
  964.  
  965. TERM(pmt,rate,fv)
  966.  
  967. The number of periods required for a given payment
  968. stream (pmt) to increase to a given future value (fv)
  969. if it grows at the given interest rate.
  970. The function is compatible with Quattro/Lotus.
  971.  
  972.  
  973. Statements
  974. ----------
  975.  
  976. BOUNDS lower,upper
  977.  
  978. Specify bounds for the domains of the variables.  The default is
  979. BOUNDS -INF,INF.  Some solving time can be saved with the
  980. statement BOUNDS -1e6,1e6 if you are sure that all the relevant
  981. values of your variables are less than a million.
  982.  
  983. CASEFOLD
  984.  
  985. Ignore case in names.  Otherwise, the variable x is different from X.
  986.  
  987. CASESTRICT
  988.  
  989. Using CASESTRICT, with no args, causes built-in functions,
  990. constants, and statements to be upper case only.  Normally such
  991. predefined names are not case sensitive, so SIN(x) is the same as
  992. sin(x).  Using this option reduces the chance of a name conflict.
  993.  
  994. COMPLEX
  995.  
  996. Declares that all the variables are to be considered complex
  997. variables.  Their solutions have a real and imaginary part.
  998. These built-in functions may be used in a complex problem:
  999.  
  1000.     ABS, COS, COSH, EXP, IM, LN, RE, SIN, SINH, SQRT,
  1001.     SUM, TAN, TANH.
  1002.  
  1003. DIGITS n
  1004.  
  1005. Display real numbers to n digits of precision.  The default is 18.
  1006.  
  1007. EPSILON x
  1008.  
  1009. Forces numbers very close to zero to be displayed as zero.  Useful
  1010. for showing complex numbers which are actually real.  Default is EPSILON 0.
  1011.  
  1012. EXTERNAL function
  1013.  
  1014. Declares the name to be an externally defined function, to be
  1015. found on the disk in the problem directory with the file name
  1016. function.BIN.  These functions are written in Turbo C++ or TASM,
  1017. and compiled into .BIN files.  See the samples.
  1018.  
  1019. FINANCE type
  1020.  
  1021. Gives the type parameter to the Quattro compatible financial
  1022. functions, PVAL, PAYMT, and FVAL.  The default is
  1023. type = 0, meaning that the payments are at the end of the
  1024. period.  Use type = 1 if the payments are at the beginning.
  1025.  
  1026. GBOUNDS xleft, xright
  1027.  
  1028. The lower (xleft) and upper (xright) bounds for the X-axis in a graph.
  1029.  
  1030. GPOINTS n
  1031.  
  1032. The number of points (function values) used to draw a graph.  The
  1033. default is 30.  If your graph is too ragged, try increasing the
  1034. number of points.
  1035.  
  1036. GSTYLE n
  1037.  
  1038. Allows graph curves to be thick (GSTYLE 0) or thin (GSTYLE 1).
  1039.  
  1040. INCLUDE filename
  1041.  
  1042. The file with the given name is inserted in the problem at
  1043. that point.  The filename must be in quotes, as in INCLUDE "CONST.INC".  The
  1044. default file name extension is .INC.  Include files cannot be nested.
  1045.  
  1046. ITERATIONS n
  1047.  
  1048. The maximum number of iterations used by the iterative solver.  The
  1049. default is 100.
  1050.  
  1051. LEGEND
  1052.  
  1053. Puts a legend on the graph which identifies the function or functions.
  1054. Recommended when plotting more than one function.
  1055.  
  1056. LEVEL n
  1057.  
  1058. Allows user control over what symbolic substitutions are made.
  1059.  
  1060. 0. no symbolic solving
  1061. 1. solve X = constant
  1062. 2. solve X = constant expression
  1063. 3. solve only when X occurs once, no other variables
  1064. 4. solve only when X occurs once, other variables possible
  1065. 5. solve linear equations
  1066. 6. solve squares, using square roots
  1067. 7. solve quadratic equations
  1068. 8. solve powers
  1069.  
  1070. The default is LEVEL 5, solving linear equations but not using
  1071. square roots.  Strictly speaking, the substitutions involving
  1072. roots are not mathematically equivalent, as the substitution must
  1073. arbitrarily choose the positive or negative square root.
  1074.  
  1075. It is sometimes preferable to use LEVEL 0 to turn off all the
  1076. symbolic manipulations.  Then Mercury effectively weights all
  1077. equations equally, and the solution can be considered the solution
  1078. to a least squares problem.
  1079.  
  1080. LIST function
  1081.  
  1082. List one or more functions in the solution window.  Syntax is the
  1083. same as for PLOT.
  1084.  
  1085. MAXIMIZE x
  1086.  
  1087. The variable x is maximized.
  1088.  
  1089. METHOD n
  1090.  
  1091. Specify the solver method, where n = 1, 2, or 3.
  1092.  
  1093. 1. Exact
  1094. 2. Direct
  1095. 3. Iterative
  1096.  
  1097. The default is METHOD 1, the exact solver.  If it fails, the direct
  1098. solver is tried, and it that also fails, the iterative solver is
  1099. tried.
  1100.  
  1101. MINIMIZE x
  1102.  
  1103. The variable x is minimized.
  1104.  
  1105. PENALTY n
  1106.  
  1107. The value of the penalty constant, an arbitrary constant used
  1108. to enforce constraints when the iterative solver is used to
  1109. maximize or minimize a variable.  The default is 30.  Increasing
  1110. it forces the approximate solutions closer to the constraint
  1111. manifold at the cost of making the extremum harder to find.  Readers
  1112. of The Hitchhiker's Guide to the Galaxy suggest using the value 42.
  1113.  
  1114. PLOT function
  1115.  
  1116. Creates a plot of the named function.  To view the graph, select
  1117. Graph from the main menu.  To plot several functions on the same
  1118. graph, list the names separated by commas.  The functions must be
  1119. defined in the problem file, and be functions of one variable.  For
  1120. example, to plot SIN(x) and x^3-x from -5 to +5, use
  1121.  
  1122.     f(x) := SIN(x)
  1123.     g(x) := x^3 - x
  1124.     GBOUNDS -5, +5
  1125.     PLOT f, g
  1126.  
  1127. PRINT
  1128.  
  1129. Same as PRINTFILE "LPT1".  It prints the graph to the DOS device LPT1,
  1130. which is usually a printer on parallel port 1.  The printing can be
  1131. configured to use another port from the Options menu, and the result
  1132. saved to a setup file.
  1133.  
  1134. PRINTFILE filename
  1135.  
  1136. Print the graph to the given file, whose name is in quotes.
  1137.  
  1138. These names have special meaning.
  1139.  
  1140.     "PAR1"    parallel port 1
  1141.     "SER1"    serial port 1
  1142.     "PAR2"    parallel port 2
  1143.     "SER2"    serial port 2
  1144.     "LPT1"    DOS lpt1
  1145.     "LPT2"    DOS lpt2
  1146.     "LPT3"    DOS lpt3
  1147.     "LPT4"    DOS lpt4
  1148.     "EPT"    IBM postscript port
  1149.  
  1150. PROGRESS x
  1151.  
  1152. Show the value of the variable x in the Progress box.  Mercury
  1153. does not solve for all variables at once, so sometimes there
  1154. might be no value for the variable until the end of the solution
  1155. process.  In such cases, the Progress window shows "x = NAN",
  1156. meaning "x is not a number".  
  1157.  
  1158. If no PROGRESS statement is given, the Progress window shows the
  1159. value of the "Residual".  This is the sum of squares of quantities
  1160. which should be zero, and which Mercury is trying to minimize.  The
  1161. smaller the value, the more likely that Mercury is getting close to
  1162. the solution.
  1163.  
  1164. REPORT filename
  1165.  
  1166. Allows naming a report file from within a problem.
  1167.  
  1168. ROOTSIGN n
  1169.  
  1170. When solving an equation like x^2 = a, Mercury may take the square
  1171. root of both sides.  This introduces two roots, +SQRT(a) and
  1172. -SQRT(a), and Mercury does not know which to take.  You can specify
  1173. that you always want the positive root with ROOTSIGN +1, or
  1174. always the negative root with ROOTSIGN -1.  The default is
  1175. ROOTSIGN 0, which leaves Mercury unable to evaluate the square
  1176. root.
  1177.  
  1178. SCREEN n
  1179.  
  1180. Choose a graphics screen.  The default is SCREEN 0, which means
  1181. Mercury automatically tries to detect your graphics hardware.
  1182. Some graphics cards and modes cannot be detected, and must be
  1183. selected with a SCREEN statement.
  1184.  
  1185.     0.    AutoDetect
  1186.     1.    CGA
  1187.     2.    MCGA
  1188.     3.    EGA 64k
  1189.     4.    EGA 256k
  1190.     5.    EGA Mono
  1191.     6.    IBM 8514
  1192.     7.    Hercules
  1193.     8.    ATT 400 line
  1194.     9.    VGA
  1195.     10.    3270 PC
  1196.     11.    Tandy 1000
  1197.     12.    ATI Super VGA
  1198.     13.    Orchid Super VGA
  1199.     14.    Paradise Super VGA
  1200.     15.    Vega Super VGA
  1201.     16.    Compro ABLE II Super VGA
  1202.     17.    SOTA Super VGA
  1203.  
  1204. From the main menu, the graphics screen can be selected with
  1205. Graph/Mode.  Such a selection is ineffective after the first
  1206. graph is drawn, as the graphics has been initialized at that
  1207. point.  We recommend saving the desired graphics mode to the
  1208. MERCURY.CFG configuration file.
  1209.  
  1210. (Note: The drivers for some of these graphics modes is not
  1211. included with some versions of Mercury.  Registered customers
  1212. receive the full set of drivers.)
  1213.  
  1214. SHOW x
  1215.  
  1216. Show specified variables in the specified order.  Other variables
  1217. are not displayed in the solution window.
  1218.  
  1219. SOLVE x
  1220.  
  1221. Instructs Mercury to solve only for the variable x.  By default, it
  1222. solves for all variables named in the problem.
  1223.  
  1224. If SOLVE is given with a polynomial function name, as in
  1225.  
  1226.     SOLVE f
  1227.     f(x) := POLY(x,1,0,0,1)
  1228.  
  1229. then Mercury will apply a special polynomial root finder to get all
  1230. real and complex roots.
  1231.  
  1232. START x
  1233.  
  1234. The starting value for uninitialized variables while using the
  1235. iterative solver.  The default is 1.00.
  1236.  
  1237. TERMS n
  1238.  
  1239. The most number of terms used by the INTEG and LIMIT functions.  The
  1240. default is 50.
  1241.  
  1242. TIME n
  1243.  
  1244. The maximum time allowed for solution.  The default is 200 seconds.
  1245. Same as MAXTIME in Eureka 1.0.
  1246.  
  1247. TITLE label
  1248.  
  1249. Argument is a quoted string, to be used as a graph title.
  1250. Default is no title.
  1251.  
  1252. SUBTITLE label
  1253.  
  1254. Argument is a quoted string, to be used as a graph subtitle.
  1255. Default is no title.
  1256.  
  1257. XLABEL label
  1258.  
  1259. A label for the X-axis of a graph.  The label must be in quotes.
  1260.  
  1261. YLABEL label
  1262.  
  1263. A label for the Y-axis of a graph.  The label must be in quotes.
  1264.  
  1265. XAXIS function
  1266.  
  1267. Specifies that the X-axis be a function instead of an independent
  1268. variable.  The function must be defined elsewhere as a function
  1269. of one variable.  
  1270.  
  1271. The X axis of the graph is a function with the given name.  Useful
  1272. for parametric plots.  Eg, to graph (x,y) = (cos(t),sin(t)) as
  1273. t goes from 0 to 2*PI, use
  1274.  
  1275.     x(t) := cos(t)
  1276.     y(t) := sin(t)
  1277.     GBOUNDS 0, 2 PI
  1278.     XAXIS x
  1279.     PLOT y
  1280.  
  1281.  
  1282.